/*
 * @filename SecurityConfiguration.java
 * @author barry
 * @version 0.0.1
 * @date 2020年1月16日
 */
package com.bnzj.core.web.security.config;

import com.bnzj.core.web.security.property.ResourcePathProperties;
import org.springframework.boot.autoconfigure.condition.ConditionalOnMissingBean;
import org.springframework.boot.context.properties.EnableConfigurationProperties;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.security.crypto.bcrypt.BCryptPasswordEncoder;
import org.springframework.security.crypto.password.PasswordEncoder;

/**
 * @author barry
 * @date 2020-01-16
 */
@Configuration
@EnableConfigurationProperties(ResourcePathProperties.class)
public class CustomSecurityConfiguration {

    @Bean
    @ConditionalOnMissingBean(name = "customPasswordEncoder")
    public PasswordEncoder passwordEncoder() {
        return new BCryptPasswordEncoder(12);
    }
}
